package com.tobeface.wechat.message.builder;

import com.tobeface.modules.lang.Requires;
import com.tobeface.wechat.message.WeChatMessageBuilder;
import com.tobeface.wechat.message.WeChatMessagePayloads;
import com.tobeface.wechat.message.WeChatMessageTypes;

import java.util.Map;

/**
 * @author loudyn
 */
public class TextTypedMessageBuilder extends AbstractTypedMessageBuilder {

    private String content;

    /**
     * @param parent
     */
    public TextTypedMessageBuilder(WeChatMessageBuilder parent) {
        super(parent);
    }

    /**
     * @param content
     * @return
     */
    public TextTypedMessageBuilder content(String content) {
        Requires.hasText(content);
        this.content = content;
        return this;
    }

    @Override
    protected void configPayloads(Map<String, Object> payloads) {
        payloads.put(WeChatMessagePayloads.MSGTYPE_PAYLOAD, WeChatMessageTypes.TEXT);
        payloads.put(WeChatMessagePayloads.CONTENT_PAYLOAD, content);
    }
}
